//当前模块对api进行统一管理
import requests from './request';
import mockRequests from './mockAjax';
//二级联动接口url: /api/classList method: get
export const reqClassList = () => requests({ url: '/classList', method: 'get' });
//获取banner（轮播图）url:/api/banner method: get(ListContainer组件里，目前没用)
export const reqGetBannerList = () => mockRequests({ url: '/banner', method: 'get' });
//获取搜索模块数据 url:/api/wares method:post 需要参数(传递的params至少是空对象)
export const reqGetSearchInfo = (data) => requests({ url: "/wares", method: "post", data})
//获取产品详情url: /api/wares/{waresId} method: get
export const reqWaresInfo = (waresId) => requests({ url: `/wares/${waresId}`, method: "get" })
//将产品添加到或更新购物车url: /api/cart/{waresId}/{waresNum} method: post
export const reqAddOrUpdateShopCart = (waresId, waresNum) => requests({ url: `/cart/${waresId}/${waresNum}`, method: "post" })
//获取购物车列表数据接口url: /api/cart/cartList method: get
export const reqCartList = () => requests({ url: '/cart/cartList', method: 'get' });
//删除购物车产品url: /api/cart/${cartId} method: get
export const reqDeleteCartById = (cartId) => requests({ url: `/cart/${cartId}`, method: "get" });
//修改购物车产品的选中状态url: /api/cart/checkCart/{cartId}/{cartState} method: get
export const reqUpdateCheckedById = (cartId, cartState) => requests({ url: `/cart/checkCart/${cartId}/${cartState}`, method: 'get' });
//提交购物车产品到订单url: /api/order/cart/{address}/{payment} method: get
export const reqCartToOrder = (address,payment) => requests({ url: `/order/cart/${address}/${payment}`, method: 'get' });
//用户注册url: /api/buyer/register method: post  
export const reqBuyerResgister = (data) => requests({ url: 'buyer/register', data, method: 'post' });
//用户登录url: /api/buyer/login method: post buyerId buyerPw
export const reqBuyerLogin = (data) => requests({ url: '/buyer/login', data, method: 'post' });
//获取用户信息(校验token) url: /api/buyer method: get 
export const reqBuyerInfo = () => requests({ url: '/buyer', method: 'get' });
//获取个人中心订单信息url: /api/order/{page}/{limit} method: get
export const reqMyOrderList=(page,limit)=>requests({url:`/order/${page}/${limit}`,method:'get'});
//取消订单url: /api/order/{orderId} method: post
export const reqDeleteOrder= (orderId) => requests({ url: `order/${orderId}`, method: 'post' });
//修改买家信息url:/api/buyer/detail method: post buyer
export const reqUpdateBuyerDetail = (data) => requests({ url: '/buyer/detail', data, method: 'post' });
//修改买家密码url:/api/buyer/detail/{oldBuyerPw}/{buyerPw} method: post 
export const reqUpdateBuyerPassword = (oldBuyerPw, buyerPw) => requests({ url: `/buyer/detail/${oldBuyerPw}/${buyerPw}`, method: "post" })
//将产品添加到收藏url: /api/collect/{waresId} method: post
export const reqAddCollect = (waresId) => requests({ url: `/collect/${waresId}`, method: "post" })
//获取个人中心收藏信息url: /collect/{page}/{limit} method: get
export const reqMyCollectList=(page,limit)=>requests({url:`/collect/${page}/${limit}`,method:'get'});
//删除收藏中的商品url: /api/collect/{collectId} method: get
export const reqDeleteCollect= (collectId) => requests({ url: `/collect/${collectId}`, method: 'get' });
//提交购物车产品到收藏url: /api/collect/cart method: get
export const reqCartToCollect = () => requests({ url: '/collect/cart', method: 'get' });
//获取个人中心历史记录url: /api/historyOrder/{page}/{limit} method: get
export const reqMyHistoryOrderList=(page,limit)=>requests({url:`/historyOrder/${page}/${limit}`,method:'get'});
//获取交易成功的历史记录url: /api/historyOrder/success method: get
export const reqSuccessHistoryOrder=()=>requests({url:'/historyOrder/success',method:'get'});
//提交售后申请url: /api/afterSales/insert method: post
export const reqAddAfterSales=(data)=>requests({url:'/afterSales/insert',method:'post',data})
//清除已冻结或已下架但出于购物车中的商品url: /api/cart/clear method: post
export const reqClearCart=()=>requests({url:'/cart/clear',method:'post'});
//改变买家默认地址url: /api/buyer/address/{address} method:post
export const reqChangeDefaultAddress=(address)=>requests({url:`/buyer/address/${address}`,method:'post'})
//改变买家默认地址url: /api/buyer/address/change/{address} method:post
export const reqChangeAddress=(data)=>requests({url:`/buyer/address/change`,method:'post',data})
//分页获取所有售后服务url: /api/buyer/afterSales/{page}/{limit}
export const reqMyAfterSalesList = (page,limit)=>requests({url:`/buyer/afterSales/${page}/${limit}`,method:'get'});
//获取所包含的所有订单数据url: /api/extendOrders/{ordersId} method:get
export const reqExtendOrdersList = (ordersId)=>requests({url:`/extendOrders/${ordersId}`,method:'get'})
//修改所包含的所有订单状态为已支付url: /api/extendOrders/change/{ordersId} method:post
export const reqChangeExtendOrdersState = (ordersId)=> requests({url:`/extendOrders/change/${ordersId}`,method:'post'})
//根据订单id获取扩展订单id url: /api/extendOrders/orders/{orderId} method:get
export const reqExtendOrdersId = (orderId)=>requests({url:`/extendOrders/orders/${orderId}`,method:'get'})